<?php

include '../config.inc.php';
include _FLEP_LIB_DIR_.'common.inc.php';

flep_session_start();

if (isset($_POST["user"]) && isset($_POST["pass"])) {

  flep_structure($_SESSION['user'], 'usuario');
  $_SESSION['user']['data'][0]['usuario'] = $_POST["user"];
  $_SESSION['user']['data'][0]['clave'] = flep_pass($_POST["pass"]);
 
  if (flep_login($_SESSION['user'])) {
    header(sprintf('Location: %s', ( isset($_SESSION['uri']) ? $_SESSION['uri'] : 'main.php')));
    exit();
  }
}
header("Location: index.php");
?>
